* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #e5e9f0;
    color: #333;
    line-height: 1.6;
    overflow: hidden;
    height: 100vh;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* 顶部工具栏 */
.toolbar {
    background: #2d3748;
    color: white;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.toolbar-title {
    font-size: 18px;
    font-weight: 600;
}

.toolbar-actions {
    display: flex;
    gap: 15px;
}

.toolbar-btn {
    background: #4a5568;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.toolbar-btn:hover {
    background: #4299e1;
}

.toolbar-btn.primary {
    background: #4299e1;
}

.toolbar-btn.primary:hover {
    background: #3182ce;
}

.toolbar-btn.danger {
    background: #dc2626;
}

.toolbar-btn.danger:hover {
    background: #b91c1c;
}

/* 主内容区 */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* 左侧面板 */
.sidebar {
    width: 380px;
    background: white;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.05);
    overflow-y: auto;
    z-index: 900;
    padding: 15px;
}
.sidebar.hidden{
    display:none;
}

.panel {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid #e2e8f0;
}

.panel-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #2d3748;
    padding-bottom: 8px;
    border-bottom: 1px solid #e2e8f0;
}

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #4a5568;
    font-size: 14px;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 14px;
    transition: border 0.2s;
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
    font-family: monospace;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

.btn {
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
    text-align: center;
    text-decoration: none;
}

.btn-primary {
    background: #4299e1;
    color: white;
}

.btn-primary:hover {
    background: #3182ce;
}

.btn-danger {
    background: #dc2626;
    color: white;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-secondary {
    background: #94a3b8;
    color: white;
}

.btn-secondary:hover {
    background: #64748b;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 12px;
}

/* 画板名称编辑区 */
.canvas-name-edit {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.canvas-name-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 14px;
}

.canvas-name-btn {
    padding: 8px 15px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 14px;
}

.btn-save {
    background: #4299e1;
    color: white;
}

.btn-delete {
    background: #dc2626;
    color: white;
}

/* 区域列表 */
.area-list {
    margin-top: 8px;
    display: grid;
    gap: 5px;
    grid-template-columns: repeat(6, 1fr);
}

.area-item {
    background: white;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 8px;
    border: 1px solid #e2e8f0;
    transition: all 0.2s;
}

.area-item:hover {
    border-color: #4299e1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.area-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.area-item-name {
    font-weight: 500;
}

.area-item-actions {
    display: flex;
    gap: 5px;
}

.area-item-meta {
    font-size: 12px;
    color: #718096;
    margin-bottom: 8px;
}

.area-edit-form {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #e2e8f0;
}

.area-edit-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

/* 画布区域 */
.canvas-container {
    flex: 1;
    overflow: auto;
    position: relative;
    background-color: #f0f2f5;
}

.canvas-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 20000px;
    height: 20000px;
    background-image: linear-gradient(to right, rgba(160, 174, 192, 0.1) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(160, 174, 192, 0.1) 1px, transparent 1px);
    background-size: 20px 20px;
    transform-origin: 0 0;
}

.canvas-workspace {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: grab;
}

.canvas-workspace.grabbing {
    cursor: grabbing;
}

/* 区域组件 */
.area-container {
    position: absolute;
    border: 1px solid #4299e1;
    border-radius: 6px;
    overflow: hidden;
    background: white;
    cursor: move;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 10;
    transform-origin: 0 0;
}

.area-container:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.area-container.dragging {
    opacity: 0.9;
    box-shadow: 0 0 20px rgba(66, 153, 225, 0.5);
    z-index: 100;
    border-color: #3182ce;
}

.area-header {
    background: #4299e1;
    color: white;
    padding: 8px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    font-size: 13px;
}

.area-title {
    font-weight: 500;
}

iframe {
    border: none;
    width: 100%;
    height: 100%;
    background: white;
}

/* 对齐辅助线 */
.alignment-guides {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
    display: none;
}

.guide-line {
    position: absolute;
    background: #ff7a00;
    opacity: 0.7;
    pointer-events: none;
}

.guide-line.horizontal {
    width: 100%;
    height: 1px;
}

.guide-line.vertical {
    width: 1px;
    height: 100%;
}

/* 提示和消息 */
.alert {
    padding: 10px 16px;
    border-radius: 4px;
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.empty-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #718096;
    font-size: 14px;
}